#pragma once
#include "../lua/ELuna.h"
#include "../gge/ggetexture.h"
#include "../gge/ggebase.h"
#include "../gge/ggecolor.h"
#include <string>
using namespace std;
using namespace ELuna;


class LuaTexture
{
public:
	LuaTexture();
	LuaTexture(gge::ggeTexture* v): m_tex(v){}
	~LuaTexture();
	bool	Texture_LoadFile(const char *filename, UINT colorKey);
	bool	Texture_LoadMem(UINT filename, ULONG size, UINT colorKey,const char *pfile);
	void	Texture_LoadStr(LuaString filename, UINT colorKey,const char *pfile);
	void	Texture_Create(int width, int height);
	void	Texture_CreateRenderTarget(int width, int height, int targetType);
	UINT	Copy(int left, int top, int width, int height);
	UINT	Lock(bool bReadOnly, int left, int top, int width, int height);
	void	Unlock();
	void	SetPixel(int x,int y,UINT c);
	UINT	GetPixel(int x,int y);
	void	FillColor(UINT color);
	bool	SaveToFile(const char *filename,int format);
	int		GetWidth(bool b = false);
	int		GetHeight(bool b = false);
	void	Grayscale();
	UINT	GetP();
	void	SetP(UINT v,const char *pfile);
	int		GetRefCount();
	void	AddRef();
	void	Release();
private:
	gge::ggeTexture*	m_tex;
	UINT*				m_lock;
	string				m_file;
};
